﻿using SDF.Core;
using SDF.Plugin.Misc.DynamicEntity.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SDF.Plugin.Misc.DynamicEntity.Services
{
    public interface IDynamicEntityService
    {
        #region Header
        DynamicEntityHeader GetEntityById(int id);

        IList<DynamicEntityHeader> GetEntitiesByIds(int[] ids);

        void UpdateEntityHeader(DynamicEntityHeader header);

        void InsertEntity(DynamicEntityHeader dynamicEntity);

        void DeleteEntities(IList<DynamicEntityHeader> dynamicEntities);

        IPagedList<DynamicEntityHeader> Query(int projectId = 0, int languageId = 0,
            int pageIndex = 0, int pageSize = int.MaxValue, bool showDel = false, bool showRefer = false, string name = "", string codeName = "");
        #endregion

        #region Item
        DynamicEntityItem GetEntityItemById(int id);

        IList<DynamicEntityItem> GetAllItemsByHeaderId(int headerId);

        IList<DynamicEntityItem> GetItemsByIds(int[] itemIds);

        void InsertEntityItem(DynamicEntityItem model);

        void InsertEntityItems(IEnumerable<DynamicEntityItem> models);

        void UpdateEntityItem(DynamicEntityItem model);

        void DeleteEntityItem(DynamicEntityItem item);

        void DeleteEntityItem(IList<DynamicEntityItem> items);
        #endregion

    }
}
